package com.share.common.mbatis.bs;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public abstract class BaseServiceImpl<T, E> implements BaseService<T,E> {
	@Autowired
	private SqlSession sqlSession;

	protected BaseMapper<T, E> baseMapper;

	public int insertSelective(T t) {
		return baseMapper.insertSelective(t);
	}

	public int deleteByPrimaryKey(Object id) {
		return baseMapper.deleteByPrimaryKey(id);
	}

	public int updateByPrimaryKeySelective(T t) {
		return baseMapper.updateByPrimaryKeySelective(t);
	}

	public T selectByPrimaryKey(Object id) {
		return baseMapper.selectByPrimaryKey(id);
	}

	public List<T> getList(E e) {
		return baseMapper.selectByExample(e);
	}

	public List<T> selectByExample(E e) {return baseMapper.selectByExample(e);}


	public long countByExample(E example){
		return baseMapper.countByExample(example);
	}

	public int deleteByExample(E example){
		return baseMapper.deleteByExample(example);
	}
	public int insert(T record){
		return baseMapper.insert(record);
	}

	public int updateByExampleSelective(T record, E example){
		return baseMapper.updateByExampleSelective(record,example);
	}
	public int updateByExample(T record, E example){
		return baseMapper.updateByExample(record,example);
	}

	public int updateByPrimaryKey(T record){
		return baseMapper.updateByPrimaryKey(record);
	}
}
